bitkeeper revision 1.1040.1.1 (40eee3a1eT0YAFxR2Vicy8vFSyHwSg)
authormwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>
Fri, 9 Jul 2004 18:27:45 +0000 (18:27 +0000)
committermwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>
Fri, 9 Jul 2004 18:27:45 +0000 (18:27 +0000)
Support for Xen console ring output.

.rootkeys
tools/python/xen/xend/XendClient.py
tools/python/xen/xend/XendDmesg.py [new file with mode: 0644]
tools/python/xen/xend/server/SrvDmesg.py [new file with mode: 0644]
tools/python/xen/xend/server/SrvRoot.py
tools/python/xen/xm/main.py

index feb8ec1995065d41089b6f71b9ada76491a03ac9..9a0453a2295320ac53c2d0cebd95c86b24266760 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 40c9c4688m3eqnC8fhLu1APm36VOVA tools/python/xen/xend/XendClient.py
 40c9c468t6iIKTjwuYoe-UMCikDcOQ tools/python/xen/xend/XendConsole.py
 40c9c468WnXs6eOUSff23IIGI4kMfQ tools/python/xen/xend/XendDB.py
+40eee3a0sPO-WUu34uHUXOC7HliDGw tools/python/xen/xend/XendDmesg.py
 40c9c468fSl3H3IypyT0ppkbb0ZT9A tools/python/xen/xend/XendDomain.py
 40c9c468bbKq3uC7_fuNUkiMMjArdw tools/python/xen/xend/XendDomainConfig.py
 40c9c4685ykq87_n1kVUbMr9flx9fg tools/python/xen/xend/XendDomainInfo.py
 40c9c468woSmBByfeXA4o_jGf2gCgA tools/python/xen/xend/server/SrvDaemon.py
 40c9c468kACsmkqjxBWKHRo071L26w tools/python/xen/xend/server/SrvDeviceDir.py
 40c9c468EQZJVkCLds-OhesJVVyZbQ tools/python/xen/xend/server/SrvDir.py
+40eee3a0m38EwYXfCSFIjWNwG6jx_A tools/python/xen/xend/server/SrvDmesg.py
 40c9c468TyHZUq8sk0FF_vxM6Sozrg tools/python/xen/xend/server/SrvDomain.py
 40c9c469WzajDjutou3X7FmL9hMf3g tools/python/xen/xend/server/SrvDomainDir.py
 40c9c469-8mYEJJTAR6w_ClrJRAfwQ tools/python/xen/xend/server/SrvEventDir.py
index 13dc3dbb1eeac682b1931a51ef9379359782b1ea..353d01ae71e67260420fdbc2d4eb2081bdb6667c 100644 (file)
@@ -79,6 +79,9 @@ def vneturl(location, root, id=''):
 def eventurl(location, root, id=''):
     return urljoin(location, root, 'event/', id)
 
+def dmesgurl(location, root, id=''):
+    return urljoin(location, root, 'dmesg/', id)
+
 def xend_request(url, method, data=None):
     urlinfo = urlparse.urlparse(url)
     (uproto, ulocation, upath, uparam, uquery, ufrag) = urlinfo
@@ -160,6 +163,9 @@ class Xend:
     def eventurl(self, id=''):
         return eventurl(self.location, self.root, id)
 
+    def dmesgurl(self, id=''):
+        return dmesgurl(self.location, self.root, id)
+
     def xend(self):
         return xend_get(urljoin(self.location, self.root))
 
@@ -281,6 +287,9 @@ class Xend:
     def xend_event_inject(self, sxpr):
         val = xend_call(self.eventurl(),
                         {'op': 'inject', 'event': fileof(sxpr) })
+
+    def xend_dmesg(self):
+        return xend_get(self.dmesgurl())
     
 
 def main(argv):
diff --git a/tools/python/xen/xend/XendDmesg.py b/tools/python/xen/xend/XendDmesg.py
new file mode 100644 (file)
index 0000000..b344f50
--- /dev/null
@@ -0,0 +1,24 @@
+# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
+
+"""Get dmesg output for this node.  Very basic right now!
+"""
+
+import os
+import xen.lowlevel.xc
+
+class XendDmesg:
+    def __init__(self):
+        self.xc = xen.lowlevel.xc.new()
+
+    def info(self):
+        return [ self.xc.readconsolering() ]
+        
+
+def instance():
+    global inst
+    try:
+        inst
+    except:
+        inst = XendDmesg()
+    return inst
+
diff --git a/tools/python/xen/xend/server/SrvDmesg.py b/tools/python/xen/xend/server/SrvDmesg.py
new file mode 100644 (file)
index 0000000..cadfd69
--- /dev/null
@@ -0,0 +1,29 @@
+# Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
+
+import os
+from SrvDir import SrvDir
+from xen.xend import sxp
+from xen.xend import XendDmesg
+
+class SrvDmesg(SrvDir):
+    """Xen Dmesg output.
+    """
+
+    def __init__(self):
+        SrvDir.__init__(self)
+        self.xd = XendDmesg.instance()
+
+    def render_GET(self, req):
+        if self.use_sxp(req):
+            req.setHeader("Content-Type", sxp.mime_type)
+            sxp.show(['dmesg'] + self.info(), out=req)
+        else:
+            req.write('<html><head></head><body>')
+            req.write('<pre>')
+            self.print_path(req)
+            req.write(self.info()[0])
+            req.write('</pre></body></html>')
+        return ''
+            
+    def info(self):
+        return self.xd.info()
index 8d38937b727e235185a3ffea31d99bf52dc15b02..1211ff4bca0a3d630553870b6494c753ae218aeb 100644 (file)
@@ -15,6 +15,7 @@ class SrvRoot(SrvDir):
     subdirs = [
         ('node',    'SrvNode'       ),
         ('domain',  'SrvDomainDir'  ),
+        ('dmesg',   'SrvDmesg'      ),
         ('console', 'SrvConsoleDir' ),
         ('event',   'SrvEventDir'   ),
         ('device',  'SrvDeviceDir'  ),
index 3ab5d23cf756f6ea326a1f775c4105b307898d75..91b7ad64d365dc6690504768622d808d71807dc2 100644 (file)
@@ -444,5 +444,15 @@ class ProgConsole(Prog):
 
 xm.prog(ProgConsole)
 
+class ProgDmesg(Prog):
+    group = 'host'
+    name  =  "dmesg"
+    info  = """Print Xen boot output."""
+
+    def main(self, args):
+        print server.xend_dmesg()[1]
+
+xm.prog(ProgDmesg)
+
 def main(args):
     xm.main(args)